import React, { useEffect } from "react";
// import store from "../redux/store";
import { show, hide } from "../redux/actionCreator/TabbarActionCreator";

import { connect } from "react-redux";
function Defail(props) {
  let { show, hide, match } = props;
  useEffect(() => {
    // console.log("创建");
    console.log("传过来的参数2", props);
    // store.dispatch通知 dispatch通知的action必须有一个type属性
    // store.dispatch(hide());
    hide();
    return () => {
      // store.dispatch(show());
      show();
      console.log("destory");
    };
  }, [match.params.myid, show, hide]);

  return <div>电影详情页</div>;
}
const mapDispatchToProps = { show, hide };
//connect接收2个参数 第一个是将来给孩子传的属性 ，第二个是将来给孩子传的回调函数
export default connect(null, mapDispatchToProps)(Defail);
